home *** CD-ROM | disk | FTP | other *** search
- ;########################
- ;# Example 1.2 ZoneTest #
- ;########################
- ; By Steven Matty
- ;
- ; This sets up 12 zones with either cicles or boxes around them
- ; If the dot comes into contact with one, the screen will flash
- ; Turn the lights down for a nice strobe :)
-
- Screen 0,0,0,320,DispHeight,4,0,"Test program",1,2
- ScreensBitMap 0,0
- BitMapOutput 0
- Use BitMap 0
- For h=0 To 12
- PalRGB 0,h,h+3,h+3,h+3
- Next h
- Use Palette 0 ; Use the palette
-
- ZoneInit 0,12 ; Clear Zones 0-12
- ad.l=ZoneTable+4
- For n=12 To 0 Step -1
- g=Int(Rnd(2)) ; Circle or Box
- If g=0
- x=Int(Rnd(320))
- x2=Int(Rnd(320))
- y=Int(Rnd(DispHeight-12))+12
- y2=Int(Rnd(DispHeight-12))+12
-
- If x>x2 Then Exchange x,x2
- If y>y2 Then Exchange y,y2
-
- Boxf x,y,x2,y2,n+3
- SetZone n,x,y,x2,y2 ; Set Box zone
- Else
- x=Int(Rnd(320-64))
- y=Int(Rnd(DispHeight-64))
-
- Circlef x,y,32,n+3
- SetZone n,x,y,32 ; Set Circular zone
- End If
- Next n
-
- SetZoneMode 0
-
- Repeat
- xm.w=SMouseX
- ym.w=SMouseY
-
- zn.w=Zone(xm,ym) ; Are we in the ZONE?
- If zn<>-1
- Locate 0,1
- Print "Zone ",zn,",",GetZoneX1(zn)," ",GetZoneX2(zn)," ",GetZoneY1(zn)," ",GetZoneY2(zn)," "
- EndIf
- VWait
- Until Joyb(0) ; Until mousebutton
- AMIGA
- End
-
-